package cc.lucien.service;

import cc.lucien.entity.Admin;
import cc.lucien.repository.AdminRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lucien-ma
 * @date 2021/11/15
 * @apiNote
 */
@Service
public class AdminService {

    @Autowired
    private AdminRepository adminRepository;

    public List<Admin> findAll() {
        return adminRepository.findAll();
    }

    public Admin findById(Integer id) {
        return adminRepository.findById(id);
    }

    public Admin findByUsernameAndPassword(Admin admin) {
        return adminRepository.findByUsernameAndPassword(admin);
    }

    public int save(Admin admin) {
        return adminRepository.save(admin);
    }

    public int update(Admin admin) {
        return adminRepository.update(admin);
    }

    public int deleteById(Integer id) {
        return adminRepository.deleteById(id);
    }
}
